package f.h.dragon.util;

import java.util.Iterator;

/**
 * This interface represents a generic storage. see {@link java.lang.Iterable}
 * 
 * @author Wenlong Meng(wenlong.meng@gmail.com)
 * @version 1.0 at 2011/11/16
 * @since 1.0 
 * @see {@link jp.gummy.commons.io.Storage}}
 * @see {@link java.lang.Iterable}}
 */
@SuppressWarnings("rawtypes")
public interface IStorage extends Iterable {

	/**
	 * put key--value to store
	 * 
	 * @param <K>
	 * @param <V>
	 * @param key
	 * @param value
	 */
	<K, V> void put(K key, V value);
	
	/**
	 * get value from store
	 * 
	 * @param <K>
	 * @param <V>
	 * @param key
	 * @return
	 */
	<K, V> V get(K key);
	
	/**
     * Returns <tt>true</tt> if this map contains a mapping for the specified
     * key.  More formally, returns <tt>true</tt> if and only if
     * this map contains a mapping for a key <tt>k</tt> such that
     * <tt>(key==null ? k==null : key.equals(k))</tt>.  (There can be
     * at most one such mapping.)
     *
     * @param key key whose presence in this map is to be tested
     * @return <tt>true</tt> if this map contains a mapping for the specified
     *         key
     * @throws ClassCastException if the key is of an inappropriate type for
     *         this map (optional)
     * @throws NullPointerException if the specified key is null and this map
     *         does not permit null keys (optional)
     */
    <T> boolean containsKey(T key);
    
    /**
     * Returns an iterator over a set of elements of type T.
     * 
     * @return an Iterator.
     */
    Iterator iterator();
	
}
